package com.zzc.controller;

import com.zzc.pojo.Admin;
import com.zzc.service.AdminService;
import com.zzc.service.serviceImpl.AdminServiceImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private AdminServiceImp adminServiceImp;

    @GetMapping("/admin")
    public String getAdmin(Model model){

        List<Admin> admins = adminServiceImp.getAdmins();
        for (Admin admin : admins) {
            System.out.println(admin);
        }
        model.addAttribute("admin",admins.get(0).getAdminName());
        return "index";
    }

}
